Skip to content

Conversation

@MarcaDian
Copy link
Contributor

Fix ReVanced settings crashes when type some symbols in search #6131 (comment) and possible fixed crashes when search in Korean #6131

use Locale.ROOT in normalizeTextToLowercase() for consistent case folding

The search index and matching must be independent of the user's UI language.
Using BaseSettings.REVANCED_LANGUAGE.get().getLocale() can break case-insensitive
matching in certain locales (e.g., Turkish 'tr_TR' where 'İ'.toLowerCase() → 'i'
without dot, while 'i'.toUpperCase() → 'İ' — causing mismatches).

Locale.ROOT provides standardized, locale-neutral case conversion:
- 'İ' → 'i' (correct)
- 'ß' → 'ss'
- Consistent behavior across all languages

This ensures reliable search for Korean, Arabic, Vietnamese, and Latin scripts
regardless of the selected ReVanced language.

Fixes incorrect search behavior when UI language is Turkish, German, etc.
@MarcaDian
Copy link
Contributor Author

MarcaDian commented Nov 3, 2025

@LisoUseInAIKyrios Hello, Look into the description of the this commit.

In my language (Ukrainian), the letter "І" (or lowercase "i") in a sorted list is always at the end of the list, although in alphabetical order it should be approximately in the middle.

Maybe using a Root locale for the sorted list will solve this problem.

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title fix(YouTube - Settings): Search crashes when searching for specific words fix(YouTube - Settings): Resolve settings search crash when searching for specific words Nov 3, 2025
@LisoUseInAIKyrios
Copy link
Contributor

It must be because those letters are different Unicode characters even though they look the same.

If the root locale conversion works then use that.

@LisoUseInAIKyrios LisoUseInAIKyrios linked an issue Nov 3, 2025 that may be closed by this pull request
3 tasks
Replaces raw String.compareTo() with Collator to ensure correct alphabetical order for all languages (e.g., Ukrainian "і", German "ä", French "é")
@MarcaDian
Copy link
Contributor Author

It seems to me that after changing the sorting method, the ReVanced settings open with some delay.

@LisoUseInAIKyrios
Copy link
Contributor

Add some temporary performance logging to check if the sorting is slow.
See

Logger.printDebug(() -> "video: " + videoId + " took: " + (System.currentTimeMillis() - startTime) + "ms");

@MarcaDian

This comment has been minimized.

@MarcaDian

This comment has been minimized.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Nov 3, 2025

I only glanced at the code, but it may be repeating the string normalization for each sorting comparison. If that is the case then normalized before sorting could fix it.

@MarcaDian
Copy link
Contributor Author

MarcaDian commented Nov 3, 2025

I was wrong, the delay is not caused by sorting, but by using new method normalizeTextToLowercase() for the search function , some optimizations need to be performed.

@MarcaDian
Copy link
Contributor Author

Probably fixed.

@LisoUseInAIKyrios
Copy link
Contributor

Ready to merge?

@MarcaDian
Copy link
Contributor Author

If there are no reviews, then yes.
Everything seems to be fine.

@LisoUseInAIKyrios LisoUseInAIKyrios merged commit 76dcfae into ReVanced:dev Nov 4, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Nov 4, 2025
# [5.46.0-dev.2](v5.46.0-dev.1...v5.46.0-dev.2) (2025-11-04)

### Bug Fixes

* **YouTube - Settings:** Resolve settings search crash when searching for specific words ([#6231](#6231)) ([76dcfae](76dcfae))
@MarcaDian MarcaDian deleted the fix-crash branch November 4, 2025 13:35
github-actions bot pushed a commit that referenced this pull request Nov 10, 2025
# [5.46.0](v5.45.0...v5.46.0) (2025-11-10)

### Bug Fixes

* **Duolingo - Disable ads:** Constrain patch to last working app target ([f238ae9](f238ae9))
* **Instagram - Hide navigation buttons:** Constrain patch to last working app target ([e030e9c](e030e9c))
* **Spotify - Hide Create button:** Remove obsolete patch that is no longer needed ([#6252](#6252)) ([59d85b2](59d85b2))
* **YouTube - Check watch history domain name resolution:** Fix false positive warning message if the internet connection fails halfway into the DNS check ([5726353](5726353))
* **YouTube - Hide layout components:** Fix "Hide Hype points" ([#6247](#6247)) ([5821440](5821440))
* **YouTube - Settings:** Add additional languages to ReVanced language preference ([d390b54](d390b54))
* **YouTube - Settings:** Resolve settings search crash when searching for specific words ([#6231](#6231)) ([76dcfae](76dcfae))

### Features

* **YouTube - Debugging:** Add setting to block experimental client flags ([#6196](#6196)) ([2e9d695](2e9d695))
* **YouTube - Hide layout components:** Add "Hide Hype points" ([#6230](#6230)) ([a52c015](a52c015))
* **YouTube - Hide layout components:** Add video description "Hide Featured content" and "Hide Subscribe button" ([#6253](#6253)) ([da4cf94](da4cf94))
* **YouTube - Hide player flyout menu items:** Add "Hide Listen with YouTube Music" ([#6232](#6232)) ([858edbf](858edbf))
* **YouTube Music:** Add `Change miniplayer color` patch ([#6259](#6259)) ([ab808ae](ab808ae))
* **YouTube Music:** Add `Hide buttons` patch ([#6255](#6255)) ([7a18ebc](7a18ebc))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(YouTube - Settings): Search crashes when searching for specific words

2 participants